/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.sdgakj.data;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.sdgakj.entity.User;

import java.text.DecimalFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.util.HtmlUtils;
import org.springside.modules.test.data.RandomData;

public class UserData {

	public static User randomNewUser() {
		User user = new User();
		user.setLoginName(RandomData.randomName("user"));
		user.setName(RandomData.randomName("User"));
		user.setPlainPassword(RandomData.randomName("password"));

		return user;
	}
	
	public static void main(String[] args) {
//        Pattern p = null;  
//        Matcher m = null;  
//        boolean b = false;   
//        p = Pattern.compile("^[1][3,4,5,7,8][0-9]{9}$"); // 验证手机号  
//        m = p.matcher("15730631747");  
//        b = m.matches();   
//       System.out.println(b);
//       String tel="18730631747";
//       System.out.println(tel.substring(tel.length()-6, tel.length()));
/*		String bodySize="1*2*";
		String[] array=bodySize.split("\\*");
		System.out.println(array.length);
		System.out.println(StringUtils.isBlank(array[0])?"+0+":array[0]);
		System.out.println(StringUtils.isBlank(array[1])?"+1+":array[1]);
		System.out.println(StringUtils.isBlank(array[2])?"+2+":array[2]);*/
		
		DecimalFormat df = new DecimalFormat("#.##");
		double d = 66.0;
		System.out.println(df.format(d));
		JSONObject object;
		String json="{'videos':[{'vid':26975741,'pid':0,'mid':61733563,'name':'《乐高大电影：蝙蝠侠》新曝预告  蝙蝠侠成|熊孩子|爹'}]}";
		object = JSON.parseObject(json);
		System.out.println(HtmlUtils.htmlEscape("我&*……%……￥……%￥%{}（）只是想试试"));
	}
}
